package com;

import org.objenesis.Objenesis;
import org.objenesis.ObjenesisStd;
import org.objenesis.instantiator.ObjectInstantiator;
import org.openjdk.jol.info.ClassLayout;

import java.io.*;

/**
 * @author: csh
 * @Date: 2021/2/8 17:47
 * @Description:验证equals错误
 */
public class Student implements Serializable {
    private String name;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void say() {
        System.out.println("hello i'm hong!"+this.age);
    }


    public static void main(String[] args) throws Exception {
        int[] arr = {1,2,3};
        System.out.println(ClassLayout.parseInstance(arr).toPrintable());
//        Student student = new Student();
//        System.out.println(ClassLayout.parseInstance(student).toPrintable());

//        student.setAge(10);
//        String filePath = "com";
//        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath));
//        oos.writeObject(student);
//        oos.close();
//        System.out.println("序列化完成！");
//
//        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filePath));
//        Student student1 = (Student) ois.readObject();
//        ois.close();
//        student1.say();
//        System.out.println("反序列化完成！");
//
//
//        Objenesis objenesis = new ObjenesisStd();
//        ObjectInstantiator<Student> instantiator = objenesis.getInstantiatorOf(Student.class);
//        Student st1 = instantiator.newInstance();
//        st1.say();
//        System.out.println(st1.toString());
//        Student st2 = instantiator.newInstance();
//        st2.say();
//        System.out.println(st2.toString());


    }
}
